{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Square and Cubic Optimization problems\n",
    "\n",
    "\n",
    "import os\n",
    "\n",
    "#set the number of workers \n",
    "num_wk=2\n",
    "\n",
    "#change mode below to switch to cubic optimization problem\n",
    "#mode = \"cubic\"\n",
    "mode=\"square\"\n",
    "\n",
    "#Run a sweep over different x_max and learning rate for Adasum and Averaging\n",
    "for x_max in [1., 2.]:\n",
    "    for op in [\"Average\", \"Adasum\"]:\n",
    "        for i in range(150):\n",
    "            lr = 0.1 + i * 0.01\n",
    "            cmd = \"mpirun -n %d --oversubscribe python adasum_small_model.py --x_max=%f --op=%s --learning_rate=%f\" % (num_wk, x_max, op, lr)\n",
    "            os.system(cmd)\n"
   ]
  }
 ],
 "metadata": {
  "file_extension": ".py",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  },
  "mimetype": "text/x-python",
  "name": "python",
  "npconvert_exporter": "python",
  "pygments_lexer": "ipython3",
  "version": 3
 },
 "nbformat": 4,
 "nbformat_minor": 2
}